{include file="header.html"}
<body class="body-main">
<ul id="admin_sub_title">
	<li class="unsub"><a href="{url('admin/ads/index')}">广告管理</a></li>
	<li class="sub"><a href="javascript:">{if $id==0}添加{else}编辑{/if}广告</a></li>
</ul>

<div id="admin_right_b">
  <form method="post">
    <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableConfig">
	<tr class="tdbg">
      <td width="120" align="right" class="config_td_first">广告标识(唯一)：</td>
      <td><input name="con[mark]" type="text" value="{$mark}" class="input" size="20"> <font color="red">*</font> 字母或数字，用于调用</td>
    </tr>

	<tr class="tdbg">
      <td align="right" class="config_td_first">广告说明：</td>
      <td><input name="con[name]" type="text" value="{$name}" class="input" size="30"></td>
    </tr>

	<tr class="tdbg">
	  <td align="right" class="config_td_first">插入页面的位置：</td>
	  <td>
	  <select name="con[insert_position]">
		<option value="0" {if !$insert_position} selected="selected"{/if}>不插入</option>
		<option value="1" {if $insert_position=='1'} selected="selected"{/if}>插入页面头部</option>
		<option value="2" {if $insert_position=='2'} selected="selected"{/if}>插入页面底部</option>
		<option value="3" {if $insert_position=='3'} selected="selected"{/if}>插入文章内容前面（内容页）</option>
		<option value="4" {if $insert_position=='4'} selected="selected"{/if}>插入文章内容后面（内容页）</option>
		<option value="5" {if $insert_position=='5'} selected="selected"{/if}>插入&lt;/head&gt;前面</option>
		<option value="6" {if $insert_position=='6'} selected="selected"{/if}>插入&lt;body&gt;后面</option>
	  </select> <span> 广告自动插入页面，插入的是js文件调用</span></td>
	</tr>
	<tr class="tdbg">
	  <td align="right" class="config_td_first">屏蔽蜘蛛：</td>
	   <td class="icheck_radios"><label><input type="radio" name="con[ban_robot]" value="1" {if $ban_robot} checked{/if}>开启</label>
			<label><input type="radio" name="con[ban_robot]" value="0" {if !$ban_robot} checked{/if}>关闭</label>　<span>屏蔽搜索引擎,不展示且禁止抓取广告</span></td>
	</tr>
	<tr>
		<td align="right" class="config_td_first">选择终端(<font color="red">new</font>)</td>
		<td class="icheck_radios">
			<label><input type="checkbox" name="terminal[]" value="pc" {if in_array('pc',$terminals)} checked="checked"{/if}>pc电脑</label>
			<label><input type="checkbox" name="terminal[]" value="android" {if in_array('android',$terminals)} checked="checked"{/if}>安卓android</label>
			<label><input type="checkbox" name="terminal[]" value="ios" {if in_array('ios',$terminals)} checked="checked"{/if}>苹果IOS</label>
			<label><input type="checkbox" name="terminal[]" value="other_mobile" {if in_array('other_mobile',$terminals)} checked="checked"{/if}>其他移动端</label>
			<span class="tips" style="color:red"><i class="typcn typcn-info"></i>选择开启广告的终端，不选则全部开启</span>
		</td>
	</tr>
	<tr>
		<td align="right" class="config_td_first">选择分组：</td>
		<td><input type="hidden" name="con[ads_group]" id="ads_group_value" value="{$ads_group}" /><font id="ads_group_items" color="#ff6600">{if !$ads_group_name}未选择{else}{$ads_group_name}{/if}</font>&nbsp;&nbsp;<a href="javascript:" class="button button_small" onclick="select_group('ads');">点击选择</a> <span class="tips" style="color:red"><i class="typcn typcn-info"></i>选择开启广告的分组</span></td>
	</tr>
	<tr class="tdbg">
      <td align="right" class="config_td_first">广告代码（<font color="red">填JS代码</font>）<br>（html的请先转为js）<br>→<a href="https://www.xxfseo.com/tools/htmljs.php" target="_blank">HTML转JS工具</a></td></td>
      <td valign="top"><textarea id="body" name="con[code]" style="width:630px;height:320px;" >{$code|htmlspecialchars}</textarea>
	  </td>
    </tr>
		<tr>
		  <td width="120">&nbsp;</td>
		  <td><button type="submit" id="dosave" class="button button_submit">保存</button> <button type="button" onClick="history.go(-1)" class="button button_grey">返回</button></td>
		</tr>
	</table>
 </form>
<script type="text/javascript">
$("#dosave").click(function(){
	showDialog();
	$.ajax({
		type:"post",
		url:"?admin-ads-update-id-{$id|default:0}",
		data:$("form").serialize(),
		dataType:'json',
		timeout:28000,
		global:false,
		success:function(data){
			if(data.status==1){
				showAlert('success','恭喜你，{if $id==0}添加{else}编辑{/if}成功',"{url('admin/ads/index')}");
			}else{
				showAlert('error',data.info);
			}
		}
	});
 return false;
});
</script>
<div class="runtime"></div>  
</div>
{include file="group_list.html"}
{include file="footer.html"}
</body>
</html>